﻿
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Core.Extensions;
using Digitalmes.Model.ProductManagement;
using Digitalmes.Model;
using Digitalmes.Model.WmsManagement;

namespace Digitalmes.ViewModel.ProductManagement.ProductBomVMs
{
    public partial class ProductBomTemplateVM : BaseTemplateVM
    {
        
        [Display(Name = "_Model._ProductBom._Product")]
        public ExcelPropety Product_Excel = ExcelPropety.CreateProperty<ProductBom>(x => x.ProductId);
        [Display(Name = "_Model._ProductBom._ProductName")]
        public ExcelPropety ProductName_Excel = ExcelPropety.CreateProperty<ProductBom>(x => x.ProductName);
        [Display(Name = "_Model._ProductBom._Material")]
        public ExcelPropety Material_Excel = ExcelPropety.CreateProperty<ProductBom>(x => x.MaterialId);
        [Display(Name = "_Model._ProductBom._MaterialName")]
        public ExcelPropety MaterialName_Excel = ExcelPropety.CreateProperty<ProductBom>(x => x.MaterialName);
        [Display(Name = "_Model._ProductBom._Qty")]
        public ExcelPropety Qty_Excel = ExcelPropety.CreateProperty<ProductBom>(x => x.Qty);
        [Display(Name = "_Model._ProductBom._Unit")]
        public ExcelPropety Unit_Excel = ExcelPropety.CreateProperty<ProductBom>(x => x.Unit);
        [Display(Name = "_Model._ProductBom._CreateTime")]
        public ExcelPropety CreateTime_Excel = ExcelPropety.CreateProperty<ProductBom>(x => x.CreateTime, true);
        [Display(Name = "_Model._ProductBom._UpdateTime")]
        public ExcelPropety UpdateTime_Excel = ExcelPropety.CreateProperty<ProductBom>(x => x.UpdateTime, true);
        [Display(Name = "_Model._ProductBom._CreateBy")]
        public ExcelPropety CreateBy_Excel = ExcelPropety.CreateProperty<ProductBom>(x => x.CreateBy);
        [Display(Name = "_Model._ProductBom._UpdateBy")]
        public ExcelPropety UpdateBy_Excel = ExcelPropety.CreateProperty<ProductBom>(x => x.UpdateBy);
        [Display(Name = "_Model._ProductBom._IsValid")]
        public ExcelPropety IsValid_Excel = ExcelPropety.CreateProperty<ProductBom>(x => x.IsValid);
        [Display(Name = "_Model._ProductBom._TenantCode")]
        public ExcelPropety TenantCode_Excel = ExcelPropety.CreateProperty<ProductBom>(x => x.TenantCode);

	    protected override void InitVM()
        {
            
            Product_Excel.DataType = ColumnDataType.ComboBox;
            Product_Excel.ListItems = DC.Set<Product>().GetSelectListItems(Wtm, y => y.TenantCode.ToString());
            Material_Excel.DataType = ColumnDataType.ComboBox;
            Material_Excel.ListItems = DC.Set<MaterialDoc>().GetSelectListItems(Wtm, y => y.TenantCode.ToString());

        }

    }

    public class ProductBomImportVM : BaseImportVM<ProductBomTemplateVM, ProductBom>
    {
            //import

    }

}